const app = getApp()
// var template = require('../../template/template.js');
// Page({
//   data: {},

//   onLoad: function () {
//     template.tabbar("tabBar", 1, this)//1表示第二个tabbar
//   },

// })


Page({
  data: {
    getjiaochenUrl:app.data.url+'/mapi/index/getjiaocheng',
    jiaocheng:[]
  },
  onLoad:function(){
    wx.showLoading({
      title: '加载中',
    })
    var user = wx.getStorageSync('user');
    var that = this;
    wx.request({
      url: that.data.getjiaochenUrl,
      method:'post',
      data:{token:user.token},
      success:function(res){
        var data = res.data;
        console.log(data);
        if (data.code==200){
          console.log(data.data);
          that.setData({ jiaocheng:data.data});
        }else{
          wx.showToast({
            title: data.msg,
            icon:'none'
          })
        }
        wx.hideLoading();
      }
    })
  },
  onShareAppMessage: function () {
    var user = wx.getStorageSync('user');
    var titles = wx.getStorageSync('titles');
    return {
      title: titles,
      path: '/pages/index/index?scene' + user.id,
    };
  },
  onPullDownRefresh:function(){
    this.onLoad();
    wx.stopPullDownRefresh({
      success: function () {
        console.log('返回了')
      }
    });
  }
})
